<template>
  <page-header-wrapper :title="false">
    <a-card>
      <div class="table-page-search-wrapper">
        <a-form layout="inline">
          <a-row :gutter="48">
            <a-col :md="6" :sm="24">
              <a-form-item label="发送日期">
                <a-range-picker v-model="value4" />
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="24">
              <a-form-item label="筛选">
                <a-input v-model="value" placeholder="请输入" />
              </a-form-item>
            </a-col>
            <a-col :md="(!advanced && 8) || 24" :sm="24">
              <span
                class="table-page-search-submitButtons"
                :style="(advanced && { float: 'right', overflow: 'hidden' }) || {}"
              >
                <a-button type="primary" :loading="loading" @click="handleSearch()">查询</a-button>
                <a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
                <!-- <a @click="toggleAdvanced" style="margin-left: 8px">
                  {{ advanced ? '收起' : '展开' }}
                  <a-icon :type="advanced ? 'up' : 'down'" />
                </a> -->
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <div class="table-operator">
        <a-button type="primary" icon="plus" @click="handleCreate()">新建通知</a-button>
      </div>

      <a-table ref="table" size="default" rowKey="key" :columns="columns" :data-source="loadData">
        <span slot="serial" slot-scope="text, record, index">
          {{ index + 1 }}
        </span>
        <span slot="status" slot-scope="text, record">
          <template>
            <a-tag color="#82af6f" v-if="record?.status == 1">启用中</a-tag>
            <a-tag color="#abbac3" v-else>已停用</a-tag>
          </template>
        </span>
        <span slot="action" slot-scope="text, record">
          <template>
            <a-tag color="#428bca" @click="handleDetail(record)">进入</a-tag>
          </template>
        </span>
      </a-table>
    </a-card>
    <create-form
      ref="createModal"
      :visible="visible"
      :loading="confirmLoading"
      :model="mdl"
      @cancel="handleCancel"
      @ok="handleOk"
    />
  </page-header-wrapper>
</template>

<script>
import { getServiceList } from '@/api/manage'
import CreateForm from './CreateForm'
export default {
  name: 'MemberListNotify',
  components: {
    CreateForm,
  },
  data() {
    return {
      mdl: null,
      priceMdl: null,
      visible: false,
      priceVisible: false,
      value: '',
      loading:false,
      confirmLoading: false,
      priceLoading: false,
      // 高级搜索 展开/关闭
      advanced: false,
      // 查询参数
      queryParam: {},
      // 表头
      columns: [
        {
          title: '发送时间',
          dataIndex: 'date',
        },
        {
          title: '发送范围',
          dataIndex: 'fanwei',
        },
        {
          title: '发送人',
          dataIndex: 'fasong',
        },
        {
          title: '送达人数',
          dataIndex: 'num',
        },
        {
          title: '发送内容',
          dataIndex: 'content',
        },
        // {
        //   title: '操作',
        //   dataIndex: 'action',
        //   width: '180px',
        //   scopedSlots: { customRender: 'action' },
        // },
      ],
      // 加载数据方法 必须为 Promise 对象
      loadData: [{ id: 1 ,date:'2023-09-15',fanwei:'1',fasong:'2',num:'2',content:'通知'}],
      optionAlertShow: false,
    }
  },
  methods: {
    handleSearch() {
      this.loading = true
      setTimeout(() => {
      this.loading = false
      }, 1000)
    },
    handleCreate(record) {
      // this.mdl = { ...record }
      this.visible = true
    },
    handleOk() {
      this.visible = false
      this.confirmLoading = true
      setTimeout(() => {
        this.confirmLoading = false
      }, 1000)
      this.$message.warn('开发中')
    },
    handleCancel() {
      this.visible = false
      const form = this.$refs.createModal.form
      form.resetFields() // 清理表单数据（可不做）
    },

    toggleAdvanced() {
      this.advanced = !this.advanced
    },
  },
}
</script>
